package com.hr.reactive.operators;

import com.hr.reactive.common.Utils;
import reactor.core.publisher.Flux;

/**
 * @author huran
 *  handle案例
 */
public class Lec02HandleUntilAssigment {
    public static void main(String[] args) {

        Flux.<String>generate(synchronousSink -> {
            synchronousSink.next(Utils.faker().country().name());
        }).handle((item,sink)->{
            sink.next(item);
            if(item.equals("Canada")){
                sink.complete();
            }
        }).subscribe(Utils.subscriber());
   }
}
